from faker import Faker

class JosephRing():
    def __init__(self,total_people_num,laber_num,death_num):  #laber_num可改成 step / interval
        self.total_people_num = total_people_num
        self.laber_num = laber_num
        self.death_num = death_num
    
    def josephRing(self):
        persons_laber = [True] * self.total_people_num
        init_death_num = 0
        init_laber_num = 0
        index = 0  #idex改成id
        existing_serialnumber = []
        death_serialnumber = []
        index_len = len(persons_laber)-1
        while init_death_num < self.death_num:
            if persons_laber[index]:
                init_laber_num += 1
                if init_laber_num == self.laber_num:
                    persons_laber[index] = False
                    init_death_num += 1
                    init_laber_num = 0
            index += 1
            index %= index_len
        return persons_laber

    
    def get_people_name(self):
        names_list = []
        for _ in range(0,self.total_people_num):
            names_list.append(Faker("zh_CN").name())
        return(names_list)


def main():
    total_people_num = int(input('请输入总人数: '))
    laber_num = int(input('请输入死亡编号: '))
    death_num = int(input('请输入应死亡的人数: '))
    jr = JosephRing(total_people_num,laber_num,death_num)
    persons_laber = jr.josephRing()
    names_list = jr.get_people_name()
    for i in range(total_people_num):
        if persons_laber[i]:
            print('第%d位为幸存者,姓名为: %s' %(i+1,names_list[i]))
        else:
            print('第%d位牺牲者,姓名为: %s' %(i+1,names_list[i]))

if __name__ == '__main__':
    main()